#pragma once

#include <stdio.h>

namespace bridge {
    
/// @brief 抽象类接口
class AbstractInterface {
public:
    AbstractInterface();
    ~AbstractInterface();

    void Request();

private:
    class Impl;
    Impl* impl_;
};

/// @brief 实现类接口
class AbstractInterface::Impl {
public:
    void Request() {
        printf("this is AbstractInterface::Impl::Request!\n");
    }
};

/// 抽象类接口的实现 - 调用实现类接口
AbstractInterface::AbstractInterface() {
    impl_ = new Impl();
}

AbstractInterface::~AbstractInterface() {
    delete impl_;
}

void AbstractInterface::Request() {
    impl_->Request();
}

} // namespace bridge

void Test_08_bridge_impl_1() {
    printf("-------------------- %s --------------------\n", __FUNCTION__);
    bridge::AbstractInterface* ptr = new bridge::AbstractInterface();
    ptr->Request();
    delete ptr;
}

// -------------------- Test_08_bridge_impl_1 --------------------
// this is AbstractInterface::Impl::Request!